package com.google.code.alpaca.prototype.client;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;

/**
 * 
 * @author drone
 * @version 1.0
 */
public class Shoutbox extends Composite {

  private final Panel messagePanel;
  private final Label header;
  private final MessageBox messageBox;
  private final MessageForm messageForm;

  public Shoutbox() {

    // create view
    messagePanel = new FlowPanel();

    header = new Label();
    messagePanel.add(header);

    messageBox = new MessageBox();
    messageBox.update();
    messagePanel.add(messageBox);

    messageForm = new MessageForm();
    messageForm.setMessageBox(messageBox);
    messagePanel.add(messageForm);

    // initialize
    initWidget(messagePanel);
  }

  public void setHeader(String text) {
    header.setText(text);
  }
}
